<html>
<head>
<#include "/common/common2.ftl"/>
</head>
<body>
	<div id="rrapp" v-cloak>
		<div v-show="showList">
			<div class="m-b-md">
				<form class="layui-form-layui-form-pane" role="form" id="searchForm" name="searchForm">
					<div class="layui-form-item">
						<!--  <label class="layui-form-label">菜单名: </label>
						<div class="layui-input-inline">
							<input class="layui-input" id="name" name="name">
						</div>-->
						<a href="javascript:void(0)" class="layui-btn layui-btn-normal" id="search">查询</a>
						<a class="layui-btn layui-btn-normal" @click="add">
							<i class="fa fa-plus"></i>
							&nbsp;新增
						</a>
						<a class="layui-btn layui-btn-normal" @click="update">
							<i class="fa fa-pencil-square-o"></i>
							&nbsp;修改
						</a>
						<a class="layui-btn layui-btn-normal" @click="del">
							<i class="fa fa-trash-o"></i>
							&nbsp;删除
						</a>
					</div>
				</form>
			</div>
			<div style="background-color: #ecf0f5;">
				<table id="menuTable" data-mobile-responsive="true" data-click-to-select="true">
					<tr>
						<th data-field="selectItem" data-checkbox="true"></th>
					</tr>
				</table>
			</div>
		</div>
		<div class="panel panel-default" v-show="!showList">
			<div class="panel-heading">{{title}}</div>
			<form class="layui-form-layui-form-pane">
				<div class="panel-body">
					<div class="layui-form-item">
						<label class="layui-form-label">菜单类型</label>
						<div class="layui-input-block">
							<select class="layui-input" v-model="menu.type" style="display: block;">
								<option value="0">目录</option>
								<option value="1">菜单</option>
								<option value="2">按钮</option>
							</select>
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">菜单名称</label>
						<div class="layui-input-block">
							<input type="text" class="layui-input" v-model="menu.name" placeholder="菜单名称或按钮名称" />
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">上级菜单</label>
						<div class="layui-input-block">
							<input type="text" class="layui-input" style="cursor: pointer;" v-model="menu.parentname" @click="menuTree" readonly="readonly" placeholder="一级菜单" />
							<input type="button" class="layui-btn layui-btn-normal" @click='deleteparentid' value="取消上级" />
						</div>
					</div>
					<div v-if="menu.type == 1|| menu.type == 2" class="layui-form-item">
						<label class="layui-form-label">菜单URL</label>
						<div class="layui-input-block">
							<input type="text" class="layui-input" v-model="menu.resurl" placeholder="菜单URL" />
						</div>
					</div>
					<div v-if="menu.type == 1 || menu.type == 2" class="layui-form-item">
						<label class="layui-form-label">菜单标识</label>
						<div class="layui-input-block">
							<input type="text" class="layui-input" v-model="menu.reskey" placeholder="如果是URL 请写URL,否则请与菜单名称一致" />
						</div>
					</div>
				</div>
				<footer class="panel-footer text-right bg-light lter">
					<div class="layui-form-item">
						<input type="button" class="layui-btn layui-btn-normal" @click="saveOrUpdate" value="确定" />
						&nbsp;&nbsp;
						<input type="button" class="layui-btn layui-btn-danger" @click="reload" value="返回" />
					</div>
				</footer>
			</form>
		</div>
	</div>
	<!-- 选择菜单 -->
	<div id="menuLayer" style="display: none; padding: 10px;">
		<ul id="menuTree" class="ztree"></ul>
	</div>
	<script type="text/javascript" src="/js/system/resources/menu.js"></script>
</body>
</html>